<?PHP
require_once 'framework/util/DataBaseLink.class.php';

class MetaObjectDaoImpl
{
	
	private $metaObject = null;
	private $dblink = null;
	private $mysqli = null;
	private $sql = null;

	public function __construct(){
		$this->dblink = new DataBaseLink();
	}
	
	public function insert($metaObject){
		
		$this->sql = "INSERT INTO `meta_modelo`(
						 `id_meta`,
						 `name`,
						 `label`,
						 `complete_label`,
						 `language`,
						 `visibility`,
						 `module`,
						 `client`
						 )
						VALUES (
						 null,
						 '".$metaObject->getName()."',
						 null,
						 '".$metaObject->getCompleteLabel()."',
						 '".$metaObject->getLanguage()."',
						 1,
						 '".$metaObject->getModule()."',
						 '".$metaObject->getClient()."'
						 
						 )";
		$this->mysqli = $this->dblink->getMysqli();
        $query = $this->mysqli->query($this->sql);	
		mysqli_close($this->mysqli);
	
	}
	
	public function remove($metaObject){
	}
	
	public function removeAll(){
		$this->sql = "DELETE FROM `meta_modelo`";
		$this->mysqli = $this->dblink->getMysqli();
        $query = $this->mysqli->query($this->sql);	
		mysqli_close($this->mysqli);
	}
	
	public function removeByImportFileType($module,$language,$client){
		$this->sql = "DELETE FROM `meta_modelo`
						where language = '$language'
						and module = '$module'
						and client = '$client'";
						
		$this->mysqli = $this->dblink->getMysqli();
        $query = $this->mysqli->query($this->sql);	
		mysqli_close($this->mysqli);
	}
	
	public function getAll(){
		$this->sql = "SELECT * FROM `meta_modelo`";
		$this->mysqli = $this->dblink->getMysqli();
        $query = $this->mysqli->query($this->sql);	
		mysqli_close($this->mysqli);
	}
	
	public function getListMetaObjectByImportFileType($module,$language,$client){
		$this->sql = "SELECT * FROM `meta_modelo`
				where language = '$language'
				and module = '$module'
				and client = '$client'";
		$this->mysqli = $this->dblink->getMysqli();		
        $query = $this->mysqli->query($this->sql);		
		mysqli_close($this->mysqli);
		return $query;
	}


}

?>